﻿<!doctype html>
 <html lang="zh-CN">
 <head>
   <meta charset="UTF-8">
   <link rel="stylesheet" href="/css/common.css">
   <link rel="stylesheet" href="/css/main.css">
   <script type="text/javascript" src="/js/jquery.min.js"></script>
   <script type="text/javascript" src="/js/colResizable-1.3.min.js"></script>
   <script type="text/javascript" src="/js/common.js"></script>


</head>
<body>
<form id="myForm" action="${req.contextPath}/resource/myself/demo2/list" method="post">
     <div id="search_bar" class="mt10">
       <div class="box">
          <div class="box_border">
            <div class="box_top"><b class="pl15">通告列表</b></div>
            <div class="box_center pt10 pb10">
              <table class="form_table" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td>名称</td>
                  <td><input type="text" name="annName" value="${annName}" class="input-text lh25" size="10"></td>
                  <td>发布时间</td>
                  <td><input type="date" name="startTimes" value="${startTimes}" class="input-text lh25" size="10">to
				  <input type="date" name="endTimes" value="${endTimes}" class="input-text lh25" size="10"></td>
                   <td><input type="submit" name="button" class="btn btn82 btn_search" value="查询">
			        <input type="button" name="button" class="btn btn82 btn_recycle" onclick="res()" value="清空"></td>
                </tr>
              </table>
            </div>
			</div>  </div>
			</form>
 <div id="table" class="mt10">
        <div class="box span10 oh">
            <form action="/excel/export" method="post">
                <#if (pageInfo.total>0)>
              <table width="100%" border="0" cellpadding="0" cellspacing="0" class="list_table">
                <tr>
				   <th> <input type="checkbox" id="checkall" onclick="checkAll()"></th>
                   <th >名称</th>
                   <th >发布人</th>
                   <th>发布时间</th>
                    </tr>
                  <#list pageInfo.list as anno>
                    <tr class="tr" align="center">
                       <td class="td_center"><input type="checkbox"  name="anIds" value="${anno.anId}" onclick="docheckAll()"></td>
                       <td><a href="${req.contextPath}/annunciate/look?anId=${anno.anId}">${anno.annName}</a></td>
                       <td>${anno.realName}</td>
                       <td>${anno.publishTime?date}</td>
                     </tr>
                  </#list>
                  <tr>
			   <td colspan="2">
			    <input type="button" name="button"  class="btn btn82 btn_export" value="导出" onclick="excel()">
				</td>
				<td colspan="5" align="right">
				     <div class="page mt10">
						<div class="pagination">
						  <ul >
							  <li class="first-child"><a href="${req.contextPath}/resource/myself/demo2/list?pageNum=1&annName=${annName}&startTimes=${startTimes}&endTimes=${endTimes}">首页</a></li>
							  <li class=""><a href="${req.contextPath}/resource/myself/demo2/list?pageNum=${(pageInfo.prePage<1)?string('1','${pageInfo.prePage}')}&annName=${annName}&startTimes=${startTimes}&endTimes=${endTimes}">上一页</a></li>
							  <li><a href="${req.contextPath}/resource/myself/demo2/list?pageNum=${(pageInfo.nextPage==0)?string('${pageInfo.pages}','${pageInfo.nextPage}')}&annName=${annName}&startTimes=${startTimes}&endTimes=${endTimes}">下一页</a></li>
							  <li ><a href="${req.contextPath}/resource/myself/demo2/list?pageNum=${pageInfo.pages}&annName=${annName}&startTimes=${startTimes}&endTimes=${endTimes}">末页</a></li>
							   <li ><span>共${pageInfo.total}条数据</span></li>
					     <li><span>共${pageInfo.pages}页</span></li>
						  </ul>
						</div>
                     </div>
				</td>
			   </tr>
              </table>
                </#if>
                <#if (pageInfo.total==0)>
                    <h1 style="margin: 10px 50px;color: green;">暂无通告信息</h1>
                </#if>
            </form>
        </div>
     </div>
</body>
 <script >
     function del(){
         confirm("确认删除");
     }
     function delall(){
         confirm("确认删除");
     }
     //全选与反选
     var checkall, item;
     checkall = document.getElementById("checkall");
     item = document.getElementsByName("anIds");
     //全选框判断：全选 全不选
     function checkAll() {
         for (var i = 0; i <item.length; i++) {
             if(checkall.checked){
                 item[i].checked = true;
             }else{
                 item[i].checked = false;
             }
         }
     }
     //单选框判断:如果单选框被选中的数量和单选框的数量相等的时候全选框选中，反之没有被选中；
     function docheckAll(){
         var count=0;
         for (var i = 0; i <item.length ; i++) {
             if(item[i].checked){
                 count++;
             }
         }
         if(count===item.length){
             checkall.checked = true;
         }else{
             checkall.checked = false;
         }
     }
     
     //导出功能的提交
     function excel() {
         confirm("确认导出");
         var name = document.getElementsByName("anIds");
         var sum=0;
         for (var i = 0; i <name.length ; i++) {
             if (name[i].checked==true){
                 sum=1;
                 break;
             }
         }
         if (sum==1) {
             //提交表单
             document.forms[1].submit();
         } else {
             alert("请选择要导出的数据");
         }
     }
     //重置按钮的方法
     function res() {
         $("#myForm")[0].reset();
     }
 </script>
</html>